import 'package:fish_redux/fish_redux.dart';

import 'action.dart';
import 'state.dart';

Reducer<MemberLoginState> buildReducer() {
  return asReducer(
    <Object, Reducer<MemberLoginState>>{
      MemberLoginAction.pwdLogin: _onPwdLoginAction,
      MemberLoginAction.smsLogin: _onSmsLoginAction,
    },
  );
}

MemberLoginState _onPwdLoginAction(MemberLoginState state, Action action) {
  final MemberLoginState newState = state.clone();
  newState..isSmsLogin = false;
  return newState;
}

MemberLoginState _onSmsLoginAction(MemberLoginState state, Action action) {
  final MemberLoginState newState = state.clone();
  newState..isSmsLogin = true;
  return newState;
}
